<?php

namespace App\Http\Controllers\BaseSet;

use App\keyword;
use Illuminate\Http\Request;

use App\Http\Requests;
use App\Http\Controllers\Controller;

class KeywordController extends Controller
{
    /*
     * 加载视图
     */
    public function index()
    {
        $data=keyword::get();
        return view('BaseSet.Keyword.index')->with(['data'=>$data]);
    }
    /*
 * 添加关键词
 */
    public function add(Request $request){
        if ($request->isMethod('post')){
            keyword::create($request->all());
            return redirect('BaseSet/Keyword');
        }
        return view('BaseSet.keyword.add');
    }
    /*
     * 删除关键词
     */
    public function del(Request $request)
    {
        $id=$request->all('id');
        keyword::destroy($id);
        return redirect('BaseSet/Keyword');
    }
}
